package com.tengju.data.domain.model.analysis.crowd;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author chenhang
 * @Date 2021/5/6
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@Getter
public enum Tag {
    NEW_USER_LOW_POTENTIAL(TagName.new_tag,"10","新人低潜力"),
    NEW_USER_MID_POTENTIAL(TagName.new_tag,"20","新人中潜力"),
    NEW_USER_HIGH_POTENTIAL(TagName.new_tag,"30","新人高潜力"),
    HIGH_BONUS_RISE(TagName.bonus_tag,"10","高收益上升"),
    HIGH_BONUS_STABLE(TagName.bonus_tag,"20","高收益稳定"),
    HIGH_BONUS_DOWN(TagName.bonus_tag,"30","高收益下降"),
    MID_BONUS_RISE(TagName.bonus_tag,"40","中收益上升"),
    MID_BONUS_STABLE(TagName.bonus_tag,"50","中收益稳定"),
    MID_BONUS_DOWN(TagName.bonus_tag,"60","中收益下降"),
    LOW_BONUS_RISE(TagName.bonus_tag,"70","低收益上升"),
    LOW_BONUS_STABLE(TagName.bonus_tag,"80","低收益稳定"),
    LOW_BONUS_DOWN(TagName.bonus_tag,"90","低收益下降");

    private TagName tagName;
    private String tagValue;
    private String showName;

    Tag(TagName tagName, String tagValue, String showName) {
        this.tagName = tagName;
        this.tagValue = tagValue;
        this.showName = showName;
    }

    public static Tag parse(String tagName,String tagValue) {
        return Arrays.stream(values()).filter(tag -> {
            return tag.tagName.name().equals(tagName) && tag.tagValue.equals(tagValue);
        }).findFirst().orElse(null);
    }
}
